<?php
/**
 * App_FormAbstract
 *
 * Set basic form options
 */
abstract class App_Form_FormAbstract extends Zend_Form
{
    /**
     * @see   Zend_Form::__construct()
     * @param mixed $options
     */
    public function __construct($options = null)
    {
        $this->addPrefixPath('App_Form', 'App/Form');
        $this->addElementPrefixPath('App_Validate', 'App/Validate', 'validate');
        $this->addElementPrefixPath('App_Filter', 'App/Filter', 'filter');
        $this->setAttrib('accept-charset', 'utf-8');

        parent::__construct($options);
    }

    /**
     * @see    Zend_Form::render()
     * @param  Zend_View_Interface $view
     * @return string
     */
    public function render(Zend_View_Interface $view = null)
    {
        // We need to make sure that every ID is unique and does not collide
        // with an ID of the layout
        foreach ($this->_elements as $element) {
            $element->id = 'form-' . $element->getId();
        }

        return parent::render($view);
    }
}
